var buf=new Buffer(256);
var offset=0;
/* var len=buf.write("aabbcc",offset,"aabbbcc".length,'utf8');
console.log("write:"+len);

var readdata=buf.toString('utf8',0,6);
console.log("data:"+readdata); */
var a=0x20;
var b=0x21;

var len=buf.write(a,offset,"8182".length,'hex');

console.log("write:"+len);

var readdata=buf.toString('hex',0,2);
console.log("data:"+readdata);

var 